﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity;
using Business.IManager;
using DataAccess.IService;
using DataAccess.Service;
using System.Data;

namespace Business.Manager
{
    public class PaymentProjectManagerImp
    {
        IPaymentProjectService paymentProjectService = new PaymentProjectService();
        List<string> studentIds = new List<string>();
        IPaymentItemManager itemManager = new PaymentItemManager();
        IAcademyManager accademyManager = new AcademyManager();
        public void generateProject(PaymentProject project)
        {
            paymentProjectService.insertProject(project);
            itemManager.generateProjectDetail(project.ProjectDetailList);
            studentIds=accademyManager.getStudentIds(project);
            geneStudentProject(project, studentIds);
            List<String> stuProjectIds = getStuProjectId(project, studentIds);
            itemManager.geneStudentPaymentDetail(project, stuProjectIds);
        }

        public List<String> getStuProjectId(PaymentProject project, List<string> studentIds)
        {
            return paymentProjectService.selectStuProjectIds(project, studentIds);
        }
        public int getMaxProjectId()
        {
           return paymentProjectService.selectMaxProjectId();
        }
        public DataSet getPaymentType()
        {
            return paymentProjectService.selectPaymentProjectType();
        }
        public void geneStudentProject(PaymentProject project, List<String> studentIds)
        {
            paymentProjectService.insertStudentProject(project, studentIds);
        }
    }
   
}
